package com.ecar.api.service.order;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.ecar.common.dto.DataBean;
import com.ecar.common.dto.DataBeanEcar;
import com.ecar.common.dto.Pager;
import com.ecar.core.driver.entity.Driver;
import com.ecar.core.order.entity.Order;
import com.wilddog.client.SyncReference;

import net.sf.json.JSONObject;

public interface OrderService {
	
	/**
	 * 25  24  31
	 * @param id
	 * @return
	 */
	List<Order> selectTodayOrder();
	List<Order> selectWorkingOrderToday();
	List<Order> selectTodayCarpool();

	int queryOrderCountByDriverId(String driverId);

	Double queryTotalPrice(String driverId);
	
	Map<String,Object> selectByDriverId(String driverId);
	
	int updateByDriverId(int orderStatus,String orderNum);
	
	Order selectByOrderNum(String orderNum);

	DataBean cancelOrder(JSONObject fields);
	
	void sendNowOrder(String orderNum);
	
	int sendOrder(Order order);

	List<Order> selectAllOrder(String driverId);

	DataBean grabOrder(Order order);
	
	List<Order> selectUnsendOrder();

	HashMap<String, Object> sendToPassengerTemp(Order order);

	List<Order> selectAppointmentOrder();
	
	List<Order> selectF2FParentOrder(String driverId);
	
	List<Order> selectAppointmentToNowOrder();

	HashMap<String, Object> sendToDriver(Order order, Driver driver,
			Integer type,String token);

	HashMap<String, Object> sendToPassenger(Order order, Driver driver);

	DataBean getInvoice(JSONObject fields);

	DataBean getInvoiceMoney(Integer passengerId);
	
	/**
	 * 拼车父节点查寻所有拼车单
	 * @param orderNum
	 * @return
	 */
	List<Order> selectOrderByParentOrder(String orderNum);

	List<Order> selectCarpoolOrderBySeat(int seat);
	
	List<Order> selectCarpoolParentOrder();
	
	List<Order> overTimeOrder();
	
	/**
	 * 获取5分钟内的预约拼车单
	 * @return
	 */
	List<Order> selectAppointmentCarpool();

	boolean send(Order order, Driver driver);
	
	int updateByPrimaryKeySelective(Order record);
	
	int updateByOrderNumSelective(Order record);
	/**
	 * 查询司机总单数
	 * @param driverId
	 * @return
	 */
	int queryDriverOrderNumber(String driverId);

	int countUnendOrderByDriverId(String driverId);
	
	int updateByOrderNum(String orderNum,Date endTime,int orderStatus,double orderPrice,int payStatus);

	DataBean getPayStatus(String orderNo);
	DataBeanEcar getByPager(Pager pager);
}
